Skip to content

Tightening build errors by warnings as errors and making more build time issues#1214

Merged
adamhathcock merged 28 commits intomasterfrom
adam/fix-editorconfig-errors
Feb 16, 2026
Merged

Tightening build errors by warnings as errors and making more build time issues#1214
adamhathcock merged 28 commits intomasterfrom
adam/fix-editorconfig-errors

Conversation

@adamhathcock
Copy link
Copy Markdown
Owner

@adamhathcock adamhathcock commented Feb 13, 2026

This pull request introduces a number of improvements to code analysis, analyzer configuration, and code quality in both the build system and main source code. The most significant changes include stricter analyzer enforcement, enhanced culture-invariant string handling, and improvements to async and memory handling in both configuration and implementation.

Analyzer configuration and enforcement:

  • Many code analysis rules in .editorconfig have been made stricter, with several suggestions promoted to errors (e.g., culture-sensitive operations, string comparison, logging, memory allocation, and async usage). This helps enforce higher code quality and consistency across the codebase.
  • Added granular analyzer configuration for different folders: stricter async/threading analyzers for src/, relaxed or disabled analyzers for build/ scripts, and more lenient rules for tests/.
  • Some style-related analyzers (e.g., IDE0040, IDE0290) have been relaxed from error to suggestion, reducing noise for non-critical style issues. [1] [2]

Build and analyzer infrastructure:

  • Removed <RunAnalyzersDuringLiveAnalysis> and <RunAnalyzersDuringBuild> from Directory.Build.props, likely to ensure analyzers always run during builds and live analysis is not explicitly disabled.

Culture-invariant and string handling improvements:

  • In build/Program.cs, all ToLower() and string operations now explicitly specify CultureInfo.InvariantCulture or StringComparison.Ordinal to avoid culture-specific bugs and improve reliability. [1] [2] [3] [4] [5]
  • In src/SharpCompress/Archives/ArchiveVolumeFactory.cs, ToString() now uses a default culture info for consistent string formatting.

Async and exception handling improvements:

  • In build/Program.cs, exception handling for git commands is now more precise, throwing InvalidOperationException instead of a generic Exception.
  • Added braces to single-line if statements for better readability and maintainability.
  • In src/SharpCompress/Archives/GZip/GZipArchive.Async.cs, simplified async writer construction, removing unnecessary options wrapping.

General code robustness:

  • Improved null/empty checks and parsing logic in benchmark parsing and memory/time value functions, making the code more robust and explicit. [1] [2] [3]

These changes collectively improve code reliability, maintainability, and enforce higher standards for both production and test code.

@adamhathcock adamhathcock marked this pull request as ready for review February 16, 2026 12:27
Copilot AI review requested due to automatic review settings February 16, 2026 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants